<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>BigNumber Errors</title>
  <script src='../../bignumber.js'></script>
</head>
<body>
  <script>
    document.body.innerHTML = 'BigNumber Errors written to console.';
    var n;

    BigNumber.config({
        DECIMAL_PLACES: 20,
        ROUNDING_MODE: 4,
        EXPONENTIAL_AT: [-7, 21],
        RANGE: 1E9,
        ERRORS: true,
        POW_PRECISION: 100
    });

    // BigNumber constructor

    try {
        n = new BigNumber(45324542.452466456546456);
    } catch (e) {
        // 'new BigNumber() number type has more than 15 significant digits: {n}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(333, 2);
    } catch (e) {
        // 'new BigNumber() not a base {b} number: {str}'
        console.error(e + '');
    }
    try {
         n = new BigNumber(123, 5.6);
    } catch (e) {
        // 'new BigNumber() base not an integer: {b}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(123, 65);
    } catch (e) {
        // 'new BigNumber() base out of range: {b}'
        console.error(e + '');
    }
    try {
        n = new BigNumber('ugh');
    } catch (e) {
        // 'new BigNumber() not a number: {n}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(1010101110011011, 2);
    } catch (e) {
        // 'new BigNumber() number type has more than 15 significant digits: {n}'
        console.error(e + '');
    }

    // config

    try {
        BigNumber.config({ DECIMAL_PLACES: 10.3 });
    } catch (e) {
        // 'config() DECIMAL_PLACES not an integer: {v}'
        console.error(e + '');
    }
    try {
        BigNumber.config({ DECIMAL_PLACES: -1 });
    } catch (e) {
        // 'config() DECIMAL_PLACES out of range: {v}'
        console.error(e + '');
    }
    try {
        BigNumber.config({ ROUNDING_MODE: 4.3 });
    } catch (e) {
        // 'config() ROUNDING_MODE not an integer: {v}'
        console.error(e + '');
    }
    try {
        BigNumber.config({ ROUNDING_MODE: 10 });
    } catch (e) {
        // 'config() ROUNDING_MODE out of range: {v}'
        console.error(e + '');
    }
    try {
        BigNumber.config({ EXPONENTIAL_AT: 10.3 });
    } catch (e) {
        // 'config() EXPONENTIAL_AT not an integer: {v}'
        console.error(e + '');
    }
    try {
        BigNumber.config({ EXPONENTIAL_AT: 1e99 });
    } catch (e) {
        // 'config() EXPONENTIAL_AT out of range: {v}'
        console.error(e + '');
    }
    try {
        BigNumber.config({ RANGE: 1.999 });
    } catch (e) {
        // 'config() RANGE not an integer: {v}'
        console.error(e + '');
    }
    try {
        BigNumber.config({ RANGE: 0 });
    } catch (e) {
        // 'config() RANGE cannot be zero: {v}'
        console.error(e + '');
    }
    try {
        BigNumber.config({ RANGE: 1e99 });
    } catch (e) {
        // 'config() RANGE out of range: {v}'
        console.error(e + '');
    }
    try {
        BigNumber.config({ ERRORS: 'ugh' });
    } catch (e) {
        // 'config() ERRORS not a boolean or binary digit: {v}'
        console.error(e + '');
    }
    try {
        BigNumber.config({ FORMAT: 1 });
    } catch (e) {
        // 'config() FORMAT not an object: {v}'
        console.error(e + '');
    }
    try {
        BigNumber.config({ CRYPTO: 'ugh' });
    } catch (e) {
        // 'config() CRYPTO not a boolean or binary digit: {v}'
        console.error(e + '');
    }
    try {
        BigNumber.config({ MODULO_MODE: 6.6  });
    } catch (e) {
        // 'config() MODULO_MODE not an integer: {v}'
        console.error(e + '');
    }
    try {
        BigNumber.config({ MODULO_MODE: 1e99  });
    } catch (e) {
        // 'config() MODULO_MODE out of range: {v}'
        console.error(e + '');
    }
    try {
        BigNumber.config({ POW_PRECISION: 1.1  });
    } catch (e) {
        // 'config() POW_PRECISION not an integer: {v}'
        console.error(e + '');
    }
    try {
        BigNumber.config({ POW_PRECISION: -1  });
    } catch (e) {
        // 'config() POW_PRECISION out of range: {v}'
        console.error(e + '');
    }

    // random

    try {
        n = BigNumber.random(10.3);
    } catch (e) {
        // 'random() decimal places not an integer: {dp}'
        console.error(e + '');
    }
    try {
        n = BigNumber.random(-1);
    } catch (e) {
        // 'random() decimal places out of range: {dp}'
        console.error(e + '');
    }
    try {
        crypto = null;
        BigNumber.config({ CRYPTO: true });
        n = BigNumber.random();
    } catch (e) {
        //'random() crypto unavailable: {crypto}'
        console.error(e + '');
    }


    // pow

    try {
        n = new BigNumber(2).pow(10.3);
    } catch (e) {
        // 'pow() exponent not an integer: {n}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).pow(Infinity);
    } catch (e) {
        // 'pow() exponent out of range: {n}'
        console.error(e + '');
    }

    // round

    try {
        n = new BigNumber(2).round(300.3);
    } catch (e) {
        // 'round() decimal places not an integer: {dp}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).round(1e99);
    } catch (e) {
        // 'round() decimal places out of range: {dp}'
        console.error(e + '');
    }
    try {
       n = new BigNumber(2).round(2, 3.3);
    } catch (e) {
        // 'round() rounding mode not an integer: {rm}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).round(3, 9);
    } catch (e) {
        // 'round() rounding mode out of range: {rm}'
        console.error(e + '');
    }

    // toDigits

    try {
        n = new BigNumber(2).toDigits(300.3);
    } catch (e) {
        // 'toDigits() precision not an integer: {sd}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toDigits(1e99);
    } catch (e) {
        // 'toDigits() precision out of range: {sd}'
        console.error(e + '');
    }
    try {
       n = new BigNumber(2).toDigits(2, 3.3);
    } catch (e) {
        // 'toDigits() rounding mode not an integer: {rm}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toDigits(3, 9);
    } catch (e) {
        // 'toDigits() rounding mode out of range: {rm}'
        console.error(e + '');
    }

    // shift

    try {
        n = new BigNumber(2).shift(300.3);
    } catch (e) {
        // 'shift() argument not an integer: {sd}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).shift(1e99);
    } catch (e) {
        // 'shift() argument out of range: {sd}'
        console.error(e + '');
    }

    // toExponential

    try {
        n = new BigNumber(2).toExponential(300.3);
    } catch (e) {
       // 'toExponential() decimal places not an integer: {dp}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toExponential(1e99);
    } catch (e) {
        // 'toExponential() decimal places out of range: {dp}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toExponential(3, 3.6);
    } catch (e) {
        // 'toExponential() rounding mode not an integer: {v}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toExponential(2, 1e99);
    } catch (e) {
        // 'toExponential() rounding mode out of range: {v}'
        console.error(e + '');
    }

    // toFixed

    try {
        n = new BigNumber(2).toFixed(300.3);
    } catch (e) {
        // 'toFixed() decimal places not an integer: {dp}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toFixed(1e99);
    } catch (e) {
        // 'toFixed() decimal places out of range: {dp}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toFixed(3, 3.6);
    } catch (e) {
        // 'toFixed() rounding mode not an integer: {v}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toFixed(2, 1e99);
    } catch (e) {
        // 'toFixed() rounding mode out of range: {v}'
        console.error(e + '');
    }

    // toFormat

    try {
        n = new BigNumber(2).toFormat(300.3);
    } catch (e) {
        // 'toFormat() decimal places not an integer: {dp}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toFormat(1e99);
    } catch (e) {
        // 'toFormat() decimal places out of range: {dp}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toFormat(3, 3.6);
    } catch (e) {
        // 'toFormat() rounding mode not an integer: {v}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toFormat(2, 1e99);
    } catch (e) {
        // 'toFormat() rounding mode out of range: {v}'
        console.error(e + '');
    }

    // toPrecision

    try {
        n = new BigNumber(2).toPrecision(300.3);
    } catch (e) {
        // 'toPrecision() decimal places not an integer: {dp}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toPrecision(0);
    } catch (e) {
        // 'toPrecision() decimal places out of range: {dp}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toPrecision(3, 3.6);
    } catch (e) {
        // 'toPrecision() rounding mode not an integer: {v}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toPrecision(2, 1e99);
    } catch (e) {
        // 'toPrecision() rounding mode out of range: {v}'
        console.error(e + '');
    }

    // toFraction

    try {
        n = new BigNumber(2).toFraction(300.3);
    } catch (e) {
        // 'toFraction() max denominator not an integer: {maxD}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toFraction(-1);
    } catch (e) {
        // 'toFraction() max denominator out of range: {maxD}'
        console.error(e + '');
    }

    // precision

    try {
        n = new BigNumber(2).precision(2);
    } catch (e) {
        // 'precision() argument not a boolean or binary digit: {z}'
        console.error(e + '');
    }

    // toString

    try {
        n = new BigNumber(2).toString(3.3);
    } catch (e) {
        // 'toString() base not an integer: {b}'
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).toString(1);
    } catch (e) {
        // 'toString() base out of range: {b}'
        console.error(e + '');
    }

    // cmp

    try {
        n = new BigNumber(2).cmp(45324542.452466456546456);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).cmp(333, 2);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).cmp(123, 5.6);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).cmp(123, 37);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).cmp('ugh');
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).cmp(8475698473265965);
    } catch (e) {
        console.error(e + '');
    }

    // div

    try {
        n = new BigNumber(2).div(45324542.452466456546456);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).div(333, 2);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).div(123, 5.6);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).div(123, 37);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).div('ugh');
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).div(8475698473265965);
    } catch (e) {
        console.error(e + '');
    }

    // eq

    try {
        n = new BigNumber(2).eq(45324542.452466456546456);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).eq(333, 2);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).eq(123, 5.6);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).eq(123, 37);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).eq('ugh');
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).eq(8475698473265965);
    } catch (e) {
        console.error(e + '');
    }

    // gt

    try {
        n = new BigNumber(2).gt(45324542.452466456546456);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).gt(333, 2);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).gt(123, 5.6);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).gt(123, 37);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).gt('ugh');
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).gt(8475698473265965);
    } catch (e) {
        console.error(e + '');
    }

    // gte

    try {
        n = new BigNumber(2).gte(45324542.452466456546456);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).gte(333, 2);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).gte(123, 5.6);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).gte(123, 37);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).gte('ugh');
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).gte(8475698473265965);
    } catch (e) {
        console.error(e + '');
    }

    // lt

    try {
        n = new BigNumber(2).lt(45324542.452466456546456);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).lt(333, 2);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).lt(123, 5.6);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).lt(123, 37);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).lt('ugh');
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).lt(8475698473265965);
    } catch (e) {
        console.error(e + '');
    }

    // lte

    try {
        n = new BigNumber(2).lte(45324542.452466456546456);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).lte(333, 2);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).lte(123, 5.6);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).lte(123, 37);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).lte('ugh');
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).lte(8475698473265965);
    } catch (e) {
        console.error(e + '');
    }

    // minus

    try {
        n = new BigNumber(2).minus(45324542.452466456546456);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).minus(333, 2);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).minus(123, 5.6);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).minus(123, 37);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).minus('ugh');
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).minus(8475698473265965);
    } catch (e) {
        console.error(e + '');
    }

    // mod

    try {
        n = new BigNumber(2).mod(45324542.452466456546456);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).mod(333, 2);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).mod(123, 5.6);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).mod(123, 37);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).mod('ugh');
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).mod(8475698473265965);
    } catch (e) {
        console.error(e + '');
    }

    // plus

    try {
        n = new BigNumber(2).plus(45324542.452466456546456);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).plus(333, 2);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).plus(123, 5.6);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).plus(123, 37);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).plus('ugh');
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).plus(8475698473265965);
    } catch (e) {
        console.error(e + '');
    }

    // pow

    try {
        n = new BigNumber(2).pow(45324542.452466456546456);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).pow(333, 2);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).pow(123, 5.6);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).pow(123, 37);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).pow('ugh');
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).pow(8475698473265965);
    } catch (e) {
        console.error(e + '');
    }

    // times

    try {
        n = new BigNumber(2).times(45324542.452466456546456);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).times(333, 2);
    } catch (e) {
        console.error(e + '');
    }
    try {
         n = new BigNumber(2).times(123, 5.6);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).times(123, 37);
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).times('ugh');
    } catch (e) {
        console.error(e + '');
    }
    try {
        n = new BigNumber(2).times(8475698473265965);
    } catch (e) {
        console.error(e + '');
    }

  </script>
</body>
</html>